﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void cmdLog_Click(object sender, EventArgs e)
    {
        DAL.UserDALs userdals = new DAL.UserDALs();
        User eadmin = userdals.GetByName(this.txtName.Text);
        
        if (eadmin == null)
        {
            alert("用户名或密码出错！");
            return;
        }

        if (eadmin.Password == txtpassword.Text.Trim())
        {
            Session["AdminName"] = eadmin.User_name;
            Response.Redirect("ErrorLog.aspx");
        }
    }

    public void alert(string msg)
    {
        Response.Write("<script>alert('" + msg + "')</script>");
    }
}
